package com.guoyh.procommon.adapter.wmodel

import com.blankj.utilcode.util.TimeUtils
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.guoyh.adapter.base.BaseRlvBindAdapter
import com.guoyh.baseutils.mylog.Loger
import com.guoyh.mcommon.R
import com.guoyh.baserepos.entity.wmodel.ArticleBean
import com.guoyh.bilbase.ext.setTextWithHtmlOrGone
import com.guoyh.mcommon.databinding.MAdapterArticleItemBinding

/**
 * @CreateDate: 7/19/21 8:08 PM
 * @Author: guoyh
 * @Description: java类作用描述
 */
class WArticleAdapter(datas: MutableList<ArticleBean>) :
    BaseRlvBindAdapter<ArticleBean, MAdapterArticleItemBinding>(
        R.layout.m_adapter_article_item, datas
    ) {
    override fun toConvert(
        holder: BaseViewHolder,
        item: ArticleBean,
        binding: MAdapterArticleItemBinding
    ) {

        binding.articleItemTitle.text = item.title
        Loger.dd(item.author)


        binding.articleItemAuthor.setTextWithHtmlOrGone(item.author)
        binding.articleItemTime.text =
            TimeUtils.getFriendlyTimeSpanByNow(TimeUtils.millis2String(item.publishTime))
        binding.articleItemDesc.setTextWithHtmlOrGone(item.desc)
    }

}